package com.aliwo.service.impl;

import com.aliwo.request.SaveScriptJobInfoRequest;
import com.aliwo.service.ScriptService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tech.powerjob.client.PowerJobClient;
import tech.powerjob.common.response.ResultDTO;

/**
 * @author:xuyayuan
 * @date:2021/7/30 9:34
 * @description:TODO
 */
@SuppressWarnings("all")
@Service
@Slf4j
@Transactional(readOnly = true, rollbackFor = Exception.class)
public class ScriptServiceImpl implements ScriptService {
    @Autowired
    private PowerJobClient powerJobClient;

    @Override
    public Long saveScriptJob(SaveScriptJobInfoRequest saveScriptJobInfoRequest) {
        ResultDTO<Long>  scriptResultDTO = powerJobClient.saveJob(saveScriptJobInfoRequest);
        return scriptResultDTO.getData();
    }
}
